/**
 * Description:
 * Class Name:ReadObject
 * Date:2022/5/2 18:20
 *
 * @author LTisme
 * @version JAVA17
 */
package 疯狂Java讲义.第15章_输入输出._15_8_Java9改进的对象序列化._15_8_2_使用对象流实现序列化;

import java.io.FileInputStream;
import java.io.ObjectInputStream;

public class ReadObject {
    public static void main(String[] args) {
        try (
                var ois = new ObjectInputStream(new FileInputStream("Chapter_15_8_object.txt"))
                ){
            var p = (Person) ois.readObject();
            System.out.println("名字为：" + p.getName() + "，年龄是：" + p.getAge());
        }
        catch (Exception e){
            e.printStackTrace();
        }
    }
}
